<?php
    session_start();
    header("content-type:text/html; charset=utf-8");
    ini_set("display_errors", "off");
    //error_reporting(E_ALL ^ E_NOTICE);
    date_default_timezone_set('Asia/Shanghai');
    define('ROOT_PATH', substr(dirname(__FILE__), 0, -8));
    define('DIR_NAME', "dialyse/weixin");

    include_once(ROOT_PATH . "includes/db_mysql.inc.php");
    include_once(ROOT_PATH . "includes/function.inc.php");
    include_once(ROOT_PATH . "includes/ajaxpager.inc.php");
    include_once(ROOT_PATH . "includes/smarty/Smarty.class.php");
    //global $_WGT
    $_WGT                         = array(); 
    $_WGT['ROOT_PATH']            = ROOT_PATH;
    $_WGT['WEB_DOMAIN']           = 'http://'.$_SERVER['HTTP_HOST'];
    $_WGT['DOMAIN_NAME']          = $_SERVER['HTTP_HOST'];
    $_WGT['DEFAULT_TITLE']        = '微信后台';
    $_WGT['FREE_UPLOAD_MAX_SIZE'] = 307200; //300M
    $_WGT['IP']                   = GetIP();
    $_WGT['TIME']                 = time();
    $_WGT['m_customer_id']		  = (int)$_REQUEST['customer_id'];

    //db config
    $_WGT['DB']['Host']     = 'localhost';
    $_WGT['DB']['User']     = 'root';
    $_WGT['DB']['Password'] = '';
    $_WGT['DB']['Database'] = 'dialyse';
    Model_Table::setAdapter($_WGT['DB']);

    $smarty                  = new Helper_MySmarty();
    $smarty->template_dir    = "templates";
    $smarty->compile_dir     = ROOT_PATH."/data/templates_c";
    $smarty->left_delimiter  = "<{";
    $smarty->right_delimiter = "}>";
    $smarty->caching         = false;

    $app_path = $_WGT['WEB_DOMAIN'].'/dialyse/weixin';
    $smarty->assign("APP_PATH", $app_path);

    $smarty->assign("DOMAIN_NAME",   $_WGT['DOMAIN_NAME']);
    $smarty->assign("ROOT_PATH",     $_WGT['ROOT_PATH']);
    $smarty->assign("WEB_DOMAIN",    $_WGT['WEB_DOMAIN']);
    $smarty->assign("DEFAULT_TITLE", $_WGT['DEFAULT_TITLE']);
?>